<!DOCTYPE html>
<html lang="en">

<head>
    <include file="Public/head" />
    <link rel="stylesheet" href="__PUBLIC__/Home/static/css/otherHome.css"/>
    <script type="text/javascript" src="__PUBLIC__/Home/static/js/jquery.qqFace.js"></script>
    <script>
        var uid = {$user.id};
        var user = {$self|json_encode};
        if (user && user.avatar == '') {
            user.avatar = default_avatar;
        }
    </script>
</head>

<body>
    <!-- 头部 -->
    <include file="Public/header" />
    <!-- /头部 -->

    <div class="main">
        <div class="main-content">
            <div class="sidebar">
                <div class="personal" style="background-image: url('{$user.background|default="__ROOT__/Public/Home/images/background.jpg"}');">
                    <div class="avatar">
                        <div class="avatar-img">
                            <img src="{$user.avatar|default="__PUBLIC__/Home/static/images/avatar-mr.png"}" alt="{$user.nickname}" alt=""/>
                        </div>
                    </div>
                    <div class="name">
                        <div class="name-box">
                            <div class="level">LV.{$user.level}</div>
                            <div class="nicheng">{$user.nickname}</div>
                            <div class="sex <switch name="user.gender">
                                <case value="男">sex1</case>
                                <case value="女">sex2</case>
                                <default />保密
                            </switch>"></div>
                        </div>
                    </div>
                    <div class="mine">
                        <ul>
                            <li>
                                <div class="mine-img mine-img1"></div>
                                <div class="mine-span" id="fans" data-count="{$user.statis.fans|default=0}">粉丝：{$user.statis.fans|default=0}</div>
                            </li>
                            <li>
                                <div class="mine-img mine-img2"></div>
                                <div class="mine-span">关注：{$user.statis.follows|default=0}</div>
                            </li>
                            <li>
                                <div class="mine-img mine-img3"></div>
                                <div class="mine-span">游戏：{$user.statis.scribe|default=0}</div>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="tips">
                    <div class="email" onclick="warning()">
                        <div class="email-img"></div>
                        <div class="email-span">发私信</div>
                    </div>
                    <if condition="$user['action']['is_follow']">
                        <div class="guanzhu active">
                            <div class="guanzhu-img"></div>
                            <div class="guanzhu-span">已关注</div>
                        </div>
                    <else />
                        <div class="guanzhu">
                            <div class="guanzhu-img add"></div>
                            <div class="guanzhu-span">加关注</div>
                        </div>
                    </if>
                </div>
                <div class="menu">
                    <ul>
                        <li>
                            <i class="menu-img1"></i>
                            <div class="menu-title">简介</div>
                            <div class="menu-content des">{$user.desc}</div>
                        </li>
                        <li>
                            <i class="menu-img2"></i>
                            <div class="menu-title">擅长游戏</div>
                            <div class="menu-content game">
                                <volist name="user.game" id="game">
                                    <span>{$game}</span>
                                </volist>
                            </div>
                        </li>
                        <li>
                            <i class="menu-img3"></i>
                            <div class="menu-title">现年</div>
                            <div class="menu-content age">{$user.age|default=0}岁</div>
                        </li>
                        <li>
                            <i class="menu-img4"></i>
                            <div class="menu-title">星座</div>
                            <div class="menu-content stars">{$user.stars}</div>
                        </li>
                        <li>
                            <i class="menu-img5"></i>
                            <div class="menu-title">爱好</div>
                            <div class="menu-content hobby">
                                <span>{$user.interest}</span>
                            </div>
                        </li>
                        <li class="bottom-no">
                            <i class="menu-img6"></i>
                            <div class="menu-title">注册时间</div>
                            <div class="menu-content c-time">{$user.reg_time|date="Y-m-d",###}</div>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="content-right">
                <div class="dongtai">
                    <div class="dongtai-box">
                        <div class="dongtai-num">
                            <span>TA的动态</span>
                            <span class="d-num">{$totalCount}条</span>
                        </div>
                        <!--<div class="dongtai-top">-->
                            <!--<div class="top-img">-->
                                <!--<img src="images/zanshi.png" alt=""/>-->
                            <!--</div>-->
                            <!--<div class="top-span">返回顶部</div>-->
                        <!--</div>-->
                    </div>
                </div>
                <if condition="$totalCount eq 0">
                    <div class="content-right-item-null">
                        <img src="__PUBLIC__/Home/static/images/null2.png" alt=""/>
                        <div>哎呀 TA没有动态</div>
                    </div>
                </if>
                <include file="Template/trade" />
            </div>
        </div>
    </div>
    <include file="common/footer" />
</body>
<script type="text/javascript" src="__PUBLIC__/Home/static/js/otherHome.js"></script>
<script type="text/javascript" src="__PUBLIC__/Home/static/js/index.js"></script>
<script type="text/javascript">
    var data_url = "{:U('Others/index', array('uid' => $user['id']))}";
    if ({$totalCount} > 0) {
        $(window).scroll(function () {
            var scrollTop = $(this).scrollTop();
            var scrollHeight = $(document).height();
            var windowHeight = $(this).height();
            if (scrollTop + windowHeight >= scrollHeight - 5 && !fetching) {
                if (!fetching) {
                    var lastEle = $('.content-right-item:last');
                    var timestamp = 0;
                    if (lastEle[0]) {
                        timestamp = lastEle.attr('data-timestamp');
                    }
                    var url = data_url + '?timestamp=' + timestamp;
                    loadData(url);
                }
            }
        });
        loadData(data_url);
    }
    followCallBack = function(fid, action){
        if (uid != fid) {
            return;
        }
        var cnt = parseInt($('.mine').find('#fans').attr('data-count'));
        if (action) {
            //取消关注，粉丝人数减一
            $('.mine').find('#fans').attr('data-count', (cnt-1));
            $('.mine').find('#fans').text("粉丝：" + (cnt-1));

            $('.guanzhu').removeClass('active');
            $('.guanzhu').find('.guanzhu-img').addClass('add');
            $('.guanzhu').find('.guanzhu-span').html('加关注');
        } else {
            $('.mine').find('#fans').attr('data-count', (cnt+1));
            $('.mine').find('#fans').text("粉丝：" + (cnt+1));

            $('.guanzhu').addClass('active');
            $('.guanzhu').find('.guanzhu-img').removeClass('add');
            $('.guanzhu').find('.guanzhu-span').html('已关注');
        }
    }
</script>
</html>